/**
 * Created by 白雨浓 on 2017/12/23 14:49.
 */
export default {
  insert(self){
    let output = `INSERT INTO \`${self.tableName}\` (`;
    for (const param of self.params) {
      if (param.name === 'state' || param.name === 'id') continue;
      output += `\n\t\`${self.toUnderline(param.name)}\`,`
    }
    output = output.slice(0, output.lastIndexOf(','));
    output += '\n)\nVALUES\n(';
    for (const param of self.params) {
      if (param.name === 'state' || param.name === 'id') continue;
      if (param.name.toLowerCase().indexOf('time') >= 0) {
        output += '\n\tNOW(),';
        continue;
      }
      output += `\n\t#{${param.name}},`
    }
    output = output.slice(0, output.lastIndexOf(','));
    output += '\n);';
    self.output = output;
  }
}
